package com.dapeis.core.utils.json;

import java.lang.reflect.Type;

import com.dapeis.domain.msg.Message;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;

public class MessageGsonAdapter implements JsonSerializer<Message> {

    @Override
    public JsonElement serialize(Message src, Type typeOfSrc,
	    JsonSerializationContext context) {
	JsonObject json = new JsonObject();
	json.addProperty("title", src.getTitle());
	json.addProperty("content", src.getContent());
	json.addProperty("agreement", src.getAgreement());
	json.addProperty("value", src.getValue());
	return json;
    }

}
